<div id="area-pie3" style="height: 100%">

</div>
<script type="text/javascript">
    $(function () {
        $.ajax({
            url: "#springUrl('/view/area/pie3')",
            data: {"batchId": "$!{batchId}"},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('area-pie3'), 'macarons');
                    var option = {
                        title: {
                            text: '储位容积使用率'
                            , show: false
                        }, grid: {
                            top: 20,
                            left: 20,
                            right: 20,
                            bottom: 20,
                            containLabel: true
                        },
                        tooltip: {
                            trigger: 'item',
                            formatter: "{a} <br/>{b} : {c} ({d}%)"
                        },
                        series: [
                            {
                                name: '储位容积使用率',
                                type: 'pie',
                                radius: '55%',
                                center: ['50%', '60%'],
                                data: d.data,
                                itemStyle: {
                                    emphasis: {
                                        shadowBlur: 10,
                                        shadowOffsetX: 0,
                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                                    },
                                    normal: {
                                        //好，这里就是重头戏了，定义一个list，然后根据所以取得不同的值，这样就实现了，
                                        color: function(params) {
                                            // build a color map as your need.
                                            var colorList = [
                                                '#0fa99d','#d9d9d9','#4472c4'
                                            ];
                                            return colorList[params.dataIndex]
                                        },
                                        //以下为是否显示，显示位置和显示格式的设置了
                                    }
                                }
                            }
                        ]
                    };
                    myChart.setOption(option);
                }
            }
        });
    });
</script>